package com.bookocean.infrastructure.converter;

import com.bookocean.domain.dto.BookCoverDto;
import com.bookocean.infrastructure.persistence.po.BookCoverPO;
import org.springframework.beans.BeanUtils;

/**
 * 书籍封面素材转换器
 */
public class BookCoverConverter {
    
    /**
     * PO转DTO
     */
    public static BookCoverDto toDto(BookCoverPO po) {
        if (po == null) {
            return null;
        }
        BookCoverDto dto = new BookCoverDto();
        BeanUtils.copyProperties(po, dto);
        return dto;
    }
    
    /**
     * DTO转PO
     */
    public static BookCoverPO toPo(BookCoverDto dto) {
        if (dto == null) {
            return null;
        }
        BookCoverPO po = new BookCoverPO();
        BeanUtils.copyProperties(dto, po);
        return po;
    }
}
